﻿using System.IO;
using System.Reflection;
using System.Windows.Markup;

namespace XamlPadHelpers
{
    [ContentProperty("AssemblyPath")]
    public class AssemblyData
    {
        public string AssemblyPath { get; set; }

        internal void Load()
        {
            FileInfo fileInfo = new FileInfo(AssemblyPath);
            if (fileInfo.Exists)
            {
                Assembly = Assembly.LoadFile(AssemblyPath);

                //Note: Sometimes it is good to load "ReflectionOnly" assemblies. This works well for .NET now. SL XamlSchemaContext needs
                //more work to handle that.

                //Assembly = Assembly.ReflectionOnlyLoadFrom(AssemblyPath);
            }
        }

        public Assembly Assembly { get; private set; }
    }
}
